import request from '../utils/request'
import {responseList, responseObject, Task, TaskClaimed, TaskCount, TranslatedTask} from "../types/entity.ts";

export namespace TaskApi {
    export function taskList() {
        return request.get<any, responseList<Task>>("/decoding-ark/claimable/task-list");
    }

    // 接口 4
    export function claimList(taskId: number) {
        return request.get<any, responseList<TaskClaimed>>(`/decoding-ark/${taskId}/claim-list`);
    }

    // 接口 5
    export function heat(taskId: number) {
        return request.post<any, responseList<TaskClaimed>>(`/decoding-ark/${taskId}/heat`);
    }

    // 接口 8
    export function taskCount() {
        return request.get<any, responseObject<TaskCount>>("/decoding-ark/unclaimed-completed-quantity");
    }

    // 接口 9
    export function top10() {
        return request.get<any, responseList<TranslatedTask>>("/decoding-ark/top10/likes");
    }

    export function claimedTask(params: any) {
        return request.post<any>("decoding-ark/claimed/task", params);
    }

    export function completedTask(taskClaimedId: number) {
        return request.post<any, responseList<TaskClaimed>>(`/decoding-ark/${taskClaimedId}/task-completed`);
    }
}
